package com.yiyi.credit.manage.abutment.common.exceptions;


import com.yiyi.credit.manage.abutment.common.enums.ResponseCode;

public class FatalExceptionBuilder {

    private String remark;
    private String title;
    private String errorCode;
    private String errorMsg;

    public FatalExceptionBuilder setRemark(String remark) {
        this.remark = remark;
        return this;
    }

    public FatalExceptionBuilder setTitle(String title) {
        this.title = title;
        return this;
    }

    public FatalExceptionBuilder setErrorCode(String errorCode) {
        this.errorCode = errorCode;
        return this;
    }

    public FatalExceptionBuilder setResponse(ResponseCode response) {
        this.errorCode = response.getCode();
        this.errorMsg = response.getMessage();
        return this;
    }

    public FatalExceptionBuilder setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }

    public FatalException build() {
        return new FatalException(errorCode, errorMsg, title, remark);
    }

}
